<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head th:replace="fragments :: head(~{::title})">
    <meta charset="UTF-8">
    <title>我的网盘</title>
</head>

<style>
    /*panel图片*/
    .back-panel{
        background-image: url("/images/background/bg02.jpg");
        background-size: 100% 70%;
        background-repeat: no-repeat;
        background-attachment: fixed;
    }
</style>

<body>


<!--导航-->
<nav th:fragment="menu(n)" class="navbar navbar-inverse lucency-sm rounded-no lucency-sm animated fadeIn">
    <div class="container">

        <div class="navbar-header">
            <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
                <span class="sr-only">切换</span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
            </button>
            <a class="navbar-brand" href="#" th:href="@{/}" ><b>创美网盘</b></a>
        </div>

        <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1" style="overflow: visible !important;">
            <ul class="nav navbar-nav">

                <li><a th:href="@{/}" href="#"><span class="glyphicon glyphicon-home"></span> 首页</a></li>
                <li><a href="#" th:href="|@{/goDisk}?pagestart=1|"><sapn class="glyphicon glyphicon-tag"></sapn> 网盘</a></li>
                <li><a href="#" th:href="@{/dynamic/index}"><sapn class="glyphicon glyphicon-align-left"></sapn> 动态</a></li>
                <li><a href="#" th:href="@{/aboutus}"><span class="glyphicon glyphicon-list"></span> 关于我们</a></li>
                <li class="active"><a href="#" th:href="@{/commentmessage}"><span class="glyphicon glyphicon-comment"></span> 留言板</a></li>
            </ul>
            <ul class="nav navbar-nav navbar-right">
                <!--<li><img id="avatar" src="http://www.blogry.cn/images/avatar.jpg" class="img-circle" width="40px" height="40px"></li>-->
                <li th:if="${user} == null"><a href="#" th:href="@{/loginIndex}"><sapn class="glyphicon glyphicon-user"></sapn> 登录</a></li>
                <!--<li><a href="#" th:href="@{/goDisk}"><sapn class="glyphicon glyphicon-bookmark"> 我的网盘</span></a></li>-->
                <li th:if="${user} != null" class="dropdown">
                    <a href="javascript:(0)" data-toggle="dropdown">
                        <img class="img-size-least img-circle" src="../static/images/avatar/avatar.jpg" th:src="${user.getAvatar()}">
                        <span th:text="${user.getNickname()}">hello</span>
                    </a>
                    <ul class="dropdown-menu dropdown-menu-left" role="menu">
                        <li role="presentation" class="dropdown-header">登录操作</li>
                        <li><a href="#" th:href="@{/user/logout}"  role="menuitem"><span class="glyphicon glyphicon-remove"></span> 注销</a></li>
                        <!--分割线-->
                        <li class="divider"></li>
                        <li role="presentation" class="dropdown-header">用户操作</li>
                        <li><a href="http://www.blogry.cn" th:href="@{/user/editor}" role="menuitem"> <span class="glyphicon glyphicon-pencil"></span> 编辑信息</a></li>
                    </ul>
                </li>
                <!--<li class=""><a href="#"><span class="glyphicon glyphicon-pencil"></span> 修改</a></li>-->
            </ul>
        </div>
    </div>
</nav>

<br>
<br>
<br>
<br>
<br>
<br>
<!--内容区域-->
<div class="container animated bounceInUp">
   <!-- <div class="panel panel-info lucency-xs rounded-size-sm" style="border: none;">-->
        <!--<div id="panelhead" class="panel-heading back-panel rounded-size-sm">-->
            <h1 class="text-color-white text-shadow-black-xs text-center font-YOUYUAN">留言板</h1>
            <br>
            <br>
            <br>
            <br>
            <br>
            <br>
            <br>
        <!--</div>-->
<!--        <div class="panel-body">-->
            <!--媒体对象-->
            <div th:each="comment : ${comments}">
                <div class="media">
                    <div class="media-left media-middle">
                        <a href="#">
                            <img th:if="${comment.getAdmin() == null}" class="media-object img-size-xxs img-circle"  src="/images/avatar/avatar.jpg">
                            <img th:if="${comment.getAdmin() != null}" th:src="${#session.getAttribute('user')} != null ? ${#session.getAttribute('user').avatar} : '/images/avatar/avatar3.jpg'" class="media-object img-size-xxs img-circle"  src="/images/avatar/avatar3.jpg">
                        </a>
                    </div>
                    <div class="media-body">
                       <h4  th:if="${comment.getAdmin() == null}" class="media-heading text-color-teal">
                           <label th:text="${comment.getNickname()}" class="label label-primary font-YOUYUAN"></label>
                        </h4>

                        <h4  th:if="${comment.getAdmin() != null}" class="media-heading text-color-white">
                           <label th:text="${comment.getNickname()}" class="label label-success font-YOUYUAN"></label>
                       </h4>

                        <span class="text-color-white text-shadow-black-xs font-YAHEI font-size-sm" th:text="${comment.getContent()}">
                                这条评论太精彩了!!
                        </span>
                    </div>
                </div>
                <hr>
            </div>

            <!--/*-->
            <div>
                <div class="media">
                    <div class="media-left media-middle">
                        <a href="#">
                            <img class="media-object img-size-xxs img-circle"  src="/images/avatar/avatar.jpg">
                        </a>
                    </div>
                    <div class="media-body">
                        <h4 class="media-heading text-color-teal"><b>小猴子</b></h4>
                        这条评论太精彩了!!
                    </div>
                </div>
                <hr>
            </div>
            <div>
                <div class="media">
                    <div class="media-left media-middle">
                        <a href="#">
                            <img class="media-object img-size-xxs img-circle"  src="/images/avatar/avatar.jpg">
                        </a>
                    </div>
                    <div class="media-body">
                        <h4 class="media-heading text-color-teal"><b>小猴子</b></h4>
                        这条评论太精彩了!!
                    </div>
                </div>
                <hr>
            </div>
            <div>
                <div class="media">
                    <div class="media-left media-middle">
                        <a href="#">
                            <img class="media-object img-size-xxs img-circle"  src="/images/avatar/avatar.jpg">
                        </a>
                    </div>
                    <div class="media-body">
                        <h4 class="media-heading text-color-teal"><b>小猴子</b></h4>
                        这条评论太精彩了!!
                    </div>
                </div>
                <hr>
            </div>
            <div>
                <div class="media">
                    <div class="media-left media-middle">
                        <a href="#">
                            <img class="media-object img-size-xxs img-circle"  src="/images/avatar/avatar.jpg">
                        </a>
                    </div>
                    <div class="media-body">
                        <h4 class="media-heading text-color-teal"><b>小猴子</b></h4>
                        这条评论太精彩了!!
                    </div>
                </div>
                <hr>
            </div>
            <div>
                <div class="media">
                    <div class="media-left media-middle">
                        <a href="#">
                            <img class="media-object img-size-xxs img-circle"  src="/images/avatar/avatar.jpg">
                        </a>
                    </div>
                    <div class="media-body">
                        <h4 class="media-heading text-color-teal"><b>小猴子</b></h4>
                        这条评论太精彩了!!
                    </div>
                </div>
                <hr>
            </div>
            <!--*/-->
<!--        </div>-->
    <br>
    <br>
    <br>
    <br>
    <br>
        <!--<div class="panel lucency-bg">
            <div class="panel-heading">-->
                <form id="form" action="#" th:action="@{/publishcomment}" class="form-inline" method="post">
                    <textarea id="content" class="form-control lucency-only-box-xs" name="content" cols="120" rows="10" placeholder="内容...."></textarea>
                    <br>
                    <br>
                    <input th:value="${#session.getAttribute('user')} != null ? ${#session.getAttribute('user').email}" id="email" type="email" name="email" class="form-control lucency-only-box-xs" placeholder="邮箱...">
                    <input th:value="${#session.getAttribute('user')} != null ? ${#session.getAttribute('user').nickname}" id="nickname" type="text" name="nickname" class="form-control lucency-only-box-xs" placeholder="昵称...">

                    <button type="button" id="subForm" class="btn btn-success lucency-only-box-xs">
                        <span class="glyphicon glyphicon-hand-up"></span> 发布
                    </button>
                </form>
                <br>
                <br>
                <br>
<!--            </div>
        </div>-->
<!--    </div>-->
</div>




<!--/*/<th:block th:replace="fragments :: script">/*/-->
<!-- jQuery (Bootstrap 的所有 JavaScript 插件都依赖 jQuery，所以必须放在前边) -->
<script src="https://cdn.jsdelivr.net/npm/jquery@1.12.4/dist/jquery.min.js"></script>
<!-- 加载 Bootstrap 的所有 JavaScript 插件。你也可以根据需要只加载单个插件。 -->
<script src="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/js/bootstrap.min.js"></script>
<!--加载bootstrap验证器-->
<script src="../static/bootstrap/js/bootstrapValidator.min.js" th:src="@{/bootstrap/js/bootstrapValidator.min.js}"></script>
<!--/*/</th:block>/*/-->

<!--表单验证-->
<script>

    $("#subForm").click(checkForm);

    function checkForm() {
        var email = $("#email");
        var nickname = $("#nickname");
        var content = $("#content");
        /*邮箱正则*/
        var emailreg = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/

        if (email.val() == ""){
            email.prop("placeholder","请输入邮箱...");
            email.focus();
        }else if(nickname.val() == ""){
            nickname.prop("placeholder","请输入昵称...");
            nickname.focus();
        }else if (content.val() == ""){
            content.prop("placeholder","请输入评论信息...");
            content.focus()
        }else if(!emailreg.test(email.val())) {
            email.focus();
            email.val("")
            email.prop("placeholder", "请输入正确的邮箱...");
        }else
            $("#form").submit();


    }

</script>
</body>
</html>